package org.ssg.dataway.config.jasypt;

import org.jasypt.encryption.StringEncryptor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.ssg.dataway.utils.CaesarCipher;

/***
 * 配置数据库密码加密 解密
 *
 */
@Configuration
@Component("desencrypt")
public class DefaultEncryptor implements StringEncryptor {
    @Value("${jasypt.encryptor.password}")
    private int password;

    @Override
    public String encrypt(String s) {
        return s;
    }

    /**
     * 解密方法   凯撒解密
     *
     * @param s
     * @return
     */
    @Override
    public String decrypt(String s) {
        String decrypt = CaesarCipher.decrypt(s,password);
        return decrypt;
    }


}
